#include "Timer.h"

	Timer::Timer()
	{
		pausedTicks = 0;
		startTicks = 0;
		paused = false;
		started = false;
	}
	void Timer::start()
	{
		started = true;
		paused = false;
		startTicks = SDL_GetTicks();
	}
	void Timer::stop()
	{
		started = false;
		paused = false;
	}
	void Timer::pause()
	{
		if((started == true) && (paused == false))
		{
			paused = true;

			pausedTicks = SDL_GetTicks()- startTicks;
		}
	}
	int Timer::getTicks()
	{
		if(started == true)
		{
			if(paused == true)
				return pausedTicks;
			else
				return (SDL_GetTicks() - startTicks);
		}
		return 0;
	}
	bool Timer::isStarted()
	{
		return started;
	}
	bool Timer::isPaused()
	{
		return paused;
	}
